﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>安装系统</title>
    @Scripts.Render("~/Scripts/jquery-1.8.2.min.js")

    @Styles.Render("http://cdn.amazeui.org/amazeui/2.5.2/css/amazeui.min.css")
    @Scripts.Render("http://cdn.amazeui.org/amazeui/2.5.2/js/amazeui.min.js")
    @Scripts.Render("http://cdn.amazeui.org/amazeui/2.5.2/js/amazeui.ie8polyfill.min.js")
    @Scripts.Render("http://cdn.amazeui.org/amazeui/2.5.2/js/amazeui.widgets.helper.min.js")

    @Scripts.Render("~/Scripts/jquery.validate.min.js")
    @Scripts.Render("~/Content/layer/js")
    <script src="~/Content/js/common/underscore.js"></script>
    <script src="~/Content/js/common/common-v1.js"></script>
    <script src="~/Content/avalon/avalon.js"></script>
    <link href="~/Content/amaze/admin.css" rel="stylesheet" />
</head>
<body>
    <!--[if lte IE 9]>
        <script src="~/Content/common/json2.js"></script>
    <p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
      以获得更好的体验！</p>
    <![endif]-->

    <header class="am-topbar admin-header">
        <div class="am-topbar-brand">
            <strong>新</strong> <small>管理系统</small>
        </div>

        <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>
    </header>

    <div class="am-cf admin-main">
        <div class="admin-content">
            <form class="am-form am-u-sm-9" data-am-validator id="form">
                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        数据库名称
                    </div>
                    <div class="am-u-sm-8 am-u-md-10">
                        <input type="text" class="am-input-sm" minlength="3"
                               name="DbHost"
                               placeholder="例如：localhost" required value="localhost" />
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        数据库名称
                    </div>
                    <div class="am-u-sm-8 am-u-md-10 am-u-end col-end">
                        <input type="text" class="am-input-sm"
                               name="DbName"
                               minlength="1">
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        数据库用户名
                    </div>
                    <div class="am-u-sm-8 am-u-md-10 am-u-end col-end">
                        <input type="text" class="am-input-sm"
                               name="DbAccount"
                               minlength="1">
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        数据库密码
                    </div>
                    <div class="am-u-sm-8 am-u-md-10">
                        <input type="text" class="am-input-sm"
                               name="DbPassword"
                               minlength="1">
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        管理员邮箱
                    </div>
                    <div class="am-u-sm-8 am-u-md-10">
                        <input type="email" class="am-input-sm"
                               name="Email"
                               minlength="2">
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        管理员密码
                    </div>
                    <div class="am-u-sm-8 am-u-md-10">
                        <input type="text" class="am-input-sm"
                               name="Password"
                               minlength="6">
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        管理员密码确认
                    </div>
                    <div class="am-u-sm-8 am-u-md-10">
                        <input type="text" class="am-input-sm"
                               name="password2"
                               minlength="1">
                    </div>
                </div>
                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        &nbsp;
                    </div>
                    <div class="am-u-sm-8 am-u-md-10">
                        <a class="am-btn am-btn-primary" href="###" onclick="install();">安装系统</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script>
        function install() {
            var data = $('#form').serializeArray();
            $.post('/installer/install', data).success(function () {
                success_msg("安装成功");
                location.href = "/secure/login";
            }).error(function () {
                error_msg("安装失败");
            });
        }
    </script>
</body>
</html>

